<?php

namespace app\common\lib;

class Show
{

    /**
     * @param array $data
     * @param string $message
     * @param int $httpStatus
     * @return \think\response\Json
     */
    public static function success($data = [], $message = "OK", $httpStatus = 200)
    {
        $result = [
            "status" => config("status.success"),
            "message" => $message,
            "result" => $data,
        ];
        return json($result, $httpStatus);
    }

    /**
     * @param array $data
     * @param string $message
     * @param int $httpStatus
     * @return \think\response\Json
     */
    public static function error($data = [], $message = "error", $httpStatus = 200)
    {
        $result = [
            "status" => config("status.error"),
            "message" => $message,
            "result" => $data,
        ];
        return json($result, $httpStatus);
    }
}